<?php

/*
 * Finds the parent of the page with the POST-id.
 *
 * Returns JSON respond with parent id
 *
 */

// Return json encoded data
header ('Content-type: application/json');

require_once '../core/db.php';

$sql = "SELECT parent FROM sitePages WHERE pageId=:id";
$query = $db -> prepare($sql);
$query -> bindParam(':id', $_POST['id']);
$query -> execute();
$res = $query -> fetch();
die(json_encode(array("respond" => $res['parent'])));
